﻿Imports GenericDescriptionLibrary

Module MainModule

    Sub Main()

        Dim myXMLFilePath As String = My.Application.Info.DirectoryPath & "\test.xml"
        If My.Application.CommandLineArgs.Count > 0 Then
            myXMLFilePath = My.Application.CommandLineArgs(0)
        End If

        'Read the Demo Data
        Dim myObjectsRead As Objects = DemoData.ReadDataFromXML(aXMLFilePath:=myXMLFilePath)
        If myObjectsRead Is Nothing Then
            Console.WriteLine("File not found. We create some demo data.")
            Dim myObjectsDemo As Objects = DemoData.CreateDemoData
            'save Demo Data
            DemoData.SaveDataAsXML(anObjects:=myObjectsDemo, aXMLFilePath:=myXMLFilePath)
            Console.WriteLine(String.Format("Demo data was written into file '{0}'", myXMLFilePath))
            'now we read it again
            myObjectsRead = DemoData.ReadDataFromXML(aXMLFilePath:=myXMLFilePath)
        Else
            Console.WriteLine(String.Format("read the file '{0}'", myXMLFilePath))
        End If

        Console.WriteLine(myObjectsRead.ToString)

        Console.WriteLine("Press any key to close")
        Console.ReadKey()

    End Sub

End Module
